package com.example.logic.chapter8.demo01;

/**
 * @Date 2023-05-02
 * @Author Jonathan
 */
public class Pair0<U, V> {
    private final U first;
    private final V second;

    public Pair0(U first, V second) {
        this.first = first;
        this.second = second;
    }

    public U getFirst() {
        return first;
    }

    public V getSecond() {
        return second;
    }

    /**
     * 调用方法的时候不需要特意指定类型参数的实际类型，Java编译器可以自动推断出来
     */
    public static <U, V> Pair0<U, V> makePair(U first, V second) {
        return new Pair0<>(first, second);
    }
}
